﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace Eugenhome.Atrium.Site.Web
{
    /// <summary>
    /// 
    /// </summary>
    public partial class _Default : System.Web.UI.Page
    {
        /// <summary></summary>
        private ImageItemCollection _iic = new ImageItemCollection();

        /// <summary></summary>
        private Login _login = new Login();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            _login.Check();

            _iic.DataFullFileName = Server.MapPath("dailyimages.xml");
            _iic.Load();

            ImageItem todayImageItem = _iic.GetTodayImage();

            lnkEdit.NavigateUrl = "defaultedit.aspx";
            lnkSearch.NavigateUrl = _iic.WikiDayHref;
            lnkInfo.Visible = !todayImageItem.DescHref.Equals(string.Empty);
            lnkInfo.NavigateUrl = todayImageItem.DescHref;


            lnkGoogleIcon.NavigateUrl = todayImageItem.DescHref;
            imgGoogleIcon.ImageUrl = todayImageItem.ImageHref;
            imgGoogleIcon.BorderWidth = 0;
            imgGoogleIcon.ToolTip = todayImageItem.Desc;

            lblCopyright.Text = "&copy;2013-" + DAO.ClientDateTimeNow.Year.ToString() + " Dolgi ";
            lblCopyright.ToolTip = DAO.ClientDateTimeNow.ToString();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnLogout_Click(object sender, EventArgs e)
        {
            Response.Redirect("login.aspx?url=" + Server.UrlEncode(Request.ServerVariables["url"]));
        }


    }
}